package top.mccat.filesystem.service;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.multipart.MultipartFile;
import top.mccat.filesystem.bean.MyFile;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

/**
 * @author JMY
 * @Description TODO
 * @Version 1.0.0
 * @Date 2023/2/22 10:15
 * @Created by JMY
 */
public interface FileService {

    /**
     * upload a file
     * @param file file to upload
     * @param author username
     * @param isCover 是否覆盖
     * @param fileRemark 文件备注
     * @param fileParent 文件父类id
     * @return my file object
     * @throws IOException ioException
     */
    public MyFile uploadFile(MultipartFile[] file, String fileRemark, Integer fileParent, Long author, boolean isCover) throws IOException;

    /**
     * list all files
     * @param file file
     * @param isAdmin is the admin account
     * @return file list
     */
    public List<MyFile> listFiles(MyFile file, boolean isAdmin);

    /**
     * download file method
     * @param file file object
     * @param httpServletResponse response object
     */
    public void downloadFile(MyFile file, HttpServletResponse httpServletResponse) throws IOException;

    /**
     * delete file method
     * @param file file object
     * @throws IOException io exception
     */
    public void deleteFile(MyFile file) throws IOException;

}
